﻿using System;
using System.Collections.Generic;
using GdNet.Core.Assistants;
using GdNet.Integrations.NHibernate.Repositories;
using GdNet.WebFramework.Domain.Repositories.System;
using GdNet.WebFramework.Domain.System;
using NHibernate;

namespace GdNet.WebFramework.Data.System
{
    public class TranslationRepository : AbstractRepository<Translation, Guid>, ITranslationRepository
    {
        public TranslationRepository(ISession nhSession)
            : base(nhSession)
        {
        }

        public IList<Translation> GetAllByLanguage(string language)
        {
            var languageProperty = ObjectAssistant.GetPropertyName<Translation, string>(x => x.Language);
            return base.FindByProperty(languageProperty, language);
        }
    }
}
